package com.zenithmind.user.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
@Schema(description = "用户注册数据传输对象")
public class RegisterDTO {

    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3到20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "newUser123")
    private String username;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    @Size(max = 100, message = "邮箱长度不能超过100个字符")
    @Schema(description = "邮箱地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "user@example.com")
    private String email;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 30, message = "密码长度必须在6到30个字符之间")
    // Consider adding more password complexity patterns if needed
    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "password123")
    private String password;

    // It's good practice to have confirmPassword in DTO if frontend sends it, but often validation is frontend-only or handled by matching 'password'
    // For backend, primary validation is on 'password'. If confirmPassword is sent, it must match.
    // If confirmPassword is not part of the DTO, the service layer might not need it if password DTO validation is robust.

    @NotBlank(message = "验证码不能为空")
    @Size(min = 4, max = 6, message = "验证码长度通常为4到6位")
    @Schema(description = "邮箱收到的验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
    private String code; // Verification code from email
} 